# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.

defmodule GoogleApi.ReplicaPool.V1beta2.Api.InstanceGroupManagers do
  @moduledoc """
  API calls for all endpoints tagged `InstanceGroupManagers`.
  """

  alias GoogleApi.ReplicaPool.V1beta2.Connection
  import GoogleApi.ReplicaPool.V1beta2.RequestBuilder

  @doc """
  Removes the specified instances from the managed instance group, and from any target pools of which they were members, without deleting the instances.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): The name of the instance group manager.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :body (InstanceGroupManagersAbandonInstancesRequest): 

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_abandon_instances(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_abandon_instances(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    %{}
    |> method(:post)
    |> url(
      "/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/abandonInstances",
      %{
        "project" => URI.encode_www_form(project),
        "zone" => URI.encode_www_form(zone),
        "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
      }
    )
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Deletes the instance group manager and all instances contained within. If you&#39;d like to delete the manager without deleting the instances, you must first abandon the instances to remove them from the group.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): Name of the Instance Group Manager resource to delete.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_delete(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    %{}
    |> method(:delete)
    |> url("/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}", %{
      "project" => URI.encode_www_form(project),
      "zone" => URI.encode_www_form(zone),
      "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
    })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Deletes the specified instances. The instances are deleted, then removed from the instance group and any target pools of which they were a member. The targetSize of the instance group manager is reduced by the number of instances deleted.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): The name of the instance group manager.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :body (InstanceGroupManagersDeleteInstancesRequest): 

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_delete_instances(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_delete_instances(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    %{}
    |> method(:post)
    |> url(
      "/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/deleteInstances",
      %{
        "project" => URI.encode_www_form(project),
        "zone" => URI.encode_www_form(zone),
        "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
      }
    )
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Returns the specified Instance Group Manager resource.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): Name of the instance resource to return.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.InstanceGroupManager{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) ::
          {:ok, GoogleApi.ReplicaPool.V1beta2.Model.InstanceGroupManager.t()}
          | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_get(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    %{}
    |> method(:get)
    |> url("/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}", %{
      "project" => URI.encode_www_form(project),
      "zone" => URI.encode_www_form(zone),
      "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
    })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.InstanceGroupManager{})
  end

  @doc """
  Creates an instance group manager, as well as the instance group and the specified number of instances.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - size (Integer): Number of instances that should exist.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :body (InstanceGroupManager): 

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          Integer.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_insert(connection, project, zone, size, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    %{}
    |> method(:post)
    |> url("/{project}/zones/{zone}/instanceGroupManagers", %{
      "project" => URI.encode_www_form(project),
      "zone" => URI.encode_www_form(zone)
    })
    |> add_param(:query, :size, size)
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Retrieves the list of Instance Group Manager resources contained within the specified zone.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :filter (String): Optional. Filter expression for filtering listed resources.
    - :max_results (Integer): Optional. Maximum count of results to be returned. Maximum value is 500 and default value is 500.
    - :page_token (String): Optional. Tag returned by a previous list request truncated by maxResults. Used to continue a previous list request.

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.InstanceGroupManagerList{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword()
        ) ::
          {:ok, GoogleApi.ReplicaPool.V1beta2.Model.InstanceGroupManagerList.t()}
          | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_list(connection, project, zone, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :filter => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    %{}
    |> method(:get)
    |> url("/{project}/zones/{zone}/instanceGroupManagers", %{
      "project" => URI.encode_www_form(project),
      "zone" => URI.encode_www_form(zone)
    })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.InstanceGroupManagerList{})
  end

  @doc """
  Recreates the specified instances. The instances are deleted, then recreated using the instance group manager&#39;s current instance template.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): The name of the instance group manager.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :body (InstanceGroupManagersRecreateInstancesRequest): 

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_recreate_instances(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_recreate_instances(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    %{}
    |> method(:post)
    |> url(
      "/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/recreateInstances",
      %{
        "project" => URI.encode_www_form(project),
        "zone" => URI.encode_www_form(zone),
        "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
      }
    )
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Resizes the managed instance group up or down. If resized up, new instances are created using the current instance template. If resized down, instances are removed in the order outlined in Resizing a managed instance group.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): The name of the instance group manager.
  - size (Integer): Number of instances that should exist in this Instance Group Manager.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_resize(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          Integer.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_resize(
        connection,
        project,
        zone,
        instance_group_manager,
        size,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    %{}
    |> method(:post)
    |> url("/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/resize", %{
      "project" => URI.encode_www_form(project),
      "zone" => URI.encode_www_form(zone),
      "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
    })
    |> add_param(:query, :size, size)
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Sets the instance template to use when creating new instances in this group. Existing instances are not affected.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): The name of the instance group manager.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :body (InstanceGroupManagersSetInstanceTemplateRequest): 

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_set_instance_template(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_set_instance_template(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    %{}
    |> method(:post)
    |> url(
      "/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/setInstanceTemplate",
      %{
        "project" => URI.encode_www_form(project),
        "zone" => URI.encode_www_form(zone),
        "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
      }
    )
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end

  @doc """
  Modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected.

  ## Parameters

  - connection (GoogleApi.ReplicaPool.V1beta2.Connection): Connection to server
  - project (String): The Google Developers Console project name.
  - zone (String): The name of the zone in which the instance group manager resides.
  - instance_group_manager (String): The name of the instance group manager.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :body (InstanceGroupManagersSetTargetPoolsRequest): 

  ## Returns

  {:ok, %GoogleApi.ReplicaPool.V1beta2.Model.Operation{}} on success
  {:error, info} on failure
  """
  @spec replicapool_instance_group_managers_set_target_pools(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.ReplicaPool.V1beta2.Model.Operation.t()} | {:error, Tesla.Env.t()}
  def replicapool_instance_group_managers_set_target_pools(
        connection,
        project,
        zone,
        instance_group_manager,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    %{}
    |> method(:post)
    |> url(
      "/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/setTargetPools",
      %{
        "project" => URI.encode_www_form(project),
        "zone" => URI.encode_www_form(zone),
        "instanceGroupManager" => URI.encode_www_form(instance_group_manager)
      }
    )
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.ReplicaPool.V1beta2.Model.Operation{})
  end
end
